/*
use "C:\Local\数据\Table 4\Enterprise Survey Data 2012.dta".dta"

keep if country=="China2012"

egen sector1 = group(stra_sector)

keep if a0==1

//Ave. number of permanent workers 1 year ago
rename l1 pemp1

//Ave. number of temporary workers 1 year ago
rename l6 temp1

g emp1 = pemp1 + temp1

//Total sales 1 year ago
rename d2 sales1


g lp = log(sales1/emp1)
g lsales = log(sales1)
g lemp = log(emp1)

//what percent of your establishment's sales - domestically/ex directly/ex indirectly 
rename d3a d
rename d3c dx
rename d3b ix

*** exporter ***
	g i_ix = ix~=0 & ix~=.
	g d_dx = dx~=0 & dx~=.

	g x = 0
		replace x = 1 if i_ix|d_dx

	tab i_ix d_dx if x

	foreach v of varlist lsales lemp lp {
		g `v'2 = `v'^2
		}

	foreach v of varlist d dx ix {
		replace `v' = `v'/100
		}

drop country a0 idstd wt stra_sector size_cat isic a2x a3ax a3 a3b a3c a5 a6b a7 ///
a7a a7c a8 a8a a9 a10 a11 a11a a14 a14_LAC a14d a14h a14m a14min a14y a15 a15_LAC ///
a15d a15h a15m a15min a15y a16 a17 a18 a19h a19min a20dend a20dstart a20mend a20mstart ///
a20yend a20ystart b1 b1x b2a b2b b2c b2d b3 b4 b4a b4a_cat b5 b6 b6a b6b b7 b7a b8 b8x ///
c1 c2 c3 c4 c5 c6 c7 c8 c8a c8b c9a c9b c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 ///
c22a c22b c23 c24a c24b c24c c24d c24f c25 c26 c27 c29 c30a c30b china_sector d1a1a d1a1x ///
d1a2 d1a3 d1b2 d1b3 sales1 d2x d d4 d5 d5a d6 d7 d8 d9 d10 d10a d11 d12a d12b d13 d14 d15 ///
d15a d16 d17 d30a d30b e1 e2 e2b e3 e4 e6 e11 e30 exporter f1 f2 g1a g1b g1c g2 g3 g4 g5 ///
g5a g5b g5bx g6a g6b g6c g7 g8 g8a g30a g30b h3x h4x h6x h7a h7b h7c h7d h7x h30 i1 i2a ///
i2b i3 i4a i4b i30 j1 j1a j2 j3 j4 j5 j6 j6a j7a j7b j8 j9 j10 j11 j12 j13 j14 j15 j30a ///
j30b j30c j30d j30e j30f j30g j30h k1a k1b k1c k1d k1e k2a k2b k2c k3a k3b k3bc k3bc1 ///
k3bc2 k3c k3d k3e k3f k3g k3h k3hd k3hdx k3i k4 k4b k5a k5a1 k5b k5bc k5bc1 k5bc1a ///
k5bc1b k5bca k5bcb k5c k5d k5e k5e1 k5f k5f1 k5g k5h k5hd k5hdJx k5hdej k5hdj k5hdj1 ///
k5i k5i1 k5j k5k k6 k7 k8 k9 k10 k11 k12 k13 k14a k14b k14c k14d k14e k15 k15a k15b ///
k15c k15d k16 k17 k18 k18a k19 k20 k20a k20a1 k21 k30 pemp1 l2 l3a l3b l4a l4a1 l4a2 ///
l4b l5 l5a l5b temp1 l6a l7 l8 l9 l9a l9a2 l9b l9b_c l10 l11a l11a1 l11b l11b1 l12 l13 ///
l14a l14b l30a l30b m1d m1a n1a n1b n1c n2a n2b n2c n2d n2e n2f n2g n2h n2i n2j n2p n2ra ///
n2rb n3 n4a n4b n5a n5b n5c n5d n6a n6b n7a n7b obst1 obst2 obst3 Official_ER_LCU_per_USD_2012 ///
Official_ER_LCU_per_USD_2014 Rotation rotation source region strata methodology sector_MS ///
sample size_num strata_all wt_rs sector1 emp1 i_ix d_dx x

save "C:\Local\数据\Table 4\table 4 data.dta"
	
*/
	
/// Table 4 Panel A

areg dx lsales lsales2, a(sector)

areg dx lemp lemp2, a(sector)

areg dx lp lp2, a(sector)

/// Table 4 Panel B

areg ix lsales lsales2, a(sector)

areg ix lemp lemp2, a(sector)

areg ix lp lp2, a(sector)

